package com.easyadmin.entity.po;

import com.easyadmin.annotation.VerifyParam;
import com.easyadmin.entity.enums.DateTimePatternEnum;
import com.easyadmin.utils.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;


/**
 * 任务调度
 */
@SuppressWarnings("serial")
public class SysTask implements Serializable {


    /**
     * 任务ID
     */
    private Integer taskId;

    /**
     * 任务名称
     */
    @VerifyParam(required = true, max = 50)
    private String taskName;

    /**
     * 任务描述
     */
    @VerifyParam(max = 300)
    private String taskDesc;

    /**
     * cron时间表达式
     */
    @VerifyParam(required = true, max = 20)
    private String cron;

    /**
     * 执行任务的类
     */
    @VerifyParam(required = true, max = 200)
    private String classz;

    /**
     * 执行任务的方法
     */
    @VerifyParam(required = true, max = 200)
    private String method;

    /**
     * 0:无参 1:有参
     */
    @VerifyParam(required = true)
    private Integer methodType;

    /**
     * 执行任务的参数
     */
    @VerifyParam(max = 500)
    private String params;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private java.util.Date createTime;

    /**
     * 0:不记录执行日志  1:记录执行日志
     */
    @VerifyParam(required = true)
    private Integer recordRunLogType;

    /**
     * 任务状态 0:暂停 1:开启
     */
    private Integer status;


    public void setTaskId(Integer taskId) {
        this.taskId = taskId;
    }

    public Integer getTaskId() {
        return this.taskId;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getTaskName() {
        return this.taskName;
    }

    public void setTaskDesc(String taskDesc) {
        this.taskDesc = taskDesc;
    }

    public String getTaskDesc() {
        return this.taskDesc;
    }

    public void setCron(String cron) {
        this.cron = cron;
    }

    public String getCron() {
        return this.cron;
    }

    public void setClassz(String classz) {
        this.classz = classz;
    }

    public String getClassz() {
        return this.classz;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getMethod() {
        return this.method;
    }

    public void setMethodType(Integer methodType) {
        this.methodType = methodType;
    }

    public Integer getMethodType() {
        return this.methodType;
    }

    public void setParams(String params) {
        this.params = params;
    }

    public String getParams() {
        return this.params;
    }

    public void setCreateTime(java.util.Date createTime) {
        this.createTime = createTime;
    }

    public java.util.Date getCreateTime() {
        return this.createTime;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return this.status;
    }

    public Integer getRecordRunLogType() {
        return recordRunLogType;
    }

    public void setRecordRunLogType(Integer recordRunLogType) {
        this.recordRunLogType = recordRunLogType;
    }

    @Override
    public String toString() {
        return "任务ID:" + (taskId == null ? "空" : taskId) + "，任务名称:" + (taskName == null ? "空" : taskName) + "，任务描述:" + (taskDesc == null ? "空" : taskDesc) + "，cron" +
                "时间表达式:" + (cron == null ? "空" : cron) + "，执行任务的类:" + (classz == null ? "空" : classz) + "，执行任务的方法:" + (method == null ? "空" : method) + "，0:无参 1:有参:" + (methodType == null ? "空" : methodType) + "，执行任务的参数:" + (params == null ? "空" : params) + "，创建时间:" + (createTime == null ? "空" : DateUtil.format(createTime, DateTimePatternEnum.YYYY_MM_DD_HH_MM_SS.getPattern())) + "，0:不记录执行日志  1:记录执行日志:" + (recordRunLogType == null ? "空" : recordRunLogType) + "，任务状态 0:暂停 1:开启:" + (status == null ? "空" : status);
    }
}
